package Waya::App::PilotGOne;

use warnings;
use strict;

our $VERSION = '0.1';

use base 'Waya::App::FileIterator';


# shorten 'Takagawa Shukaku' to 'Takagawa'; plus some special rules;

sub shorten_name {
    my ($self, $name) = @_;
    return 'Wu' if $name =~ /\bGo\s+Seigen\b/i;
    return $1 if $name =~ /(\w+)/;
    return $name;
}


sub process_game {
    my $self = shift;
    my $info = $self->game->game_info_node;
    $info->{_header} = sprintf "%s - %s %s", map { $_ || '?' }
        $self->shorten_name($info->{PW}),
        $self->shorten_name($info->{PB}),
        $info->{DT};
}


1;
